//
//  FObject.h
//  test
//
//  Created by 袁飞 on 12-5-29.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "cocos2d.h"
#import "FAI.h"
//#import "FFlashImg.h"
@interface FObject : CCLayer
{
  NSMutableDictionary* compants_sprite_;
  NSMutableDictionary* actions_;
  FAI *ai_;
  NSString* name_;
}
//@property (nonatomic, readwrite) FAI* ai;
@property (nonatomic, readwrite) NSString* name;


-(id)init;
+(FObject*)FObjectFromImg:(NSString*)name XY:(CGPoint)xy Count:(int)count;
+(FObject*)FObjectFromXmlFile:(NSString*)name WithDict:(NSMutableDictionary*)dict;

//-(id)initWithImg:(FFlashImg*)img;
-(id)initWithXml:(NSString*)file;
-(void)moveTo:(CGPoint)p Dur:(float)dur;
-(void)moveBy:(CGPoint)p Dur:(float)dur;
-(void)moveBy:(CGPoint)p Dur:(float)dur withSprite:(NSString*)name;
-(void)addSprite:(CCSprite*)sp Named:(NSString*)name;
-(CCSprite*)getSpriteByName:(NSString*)name;
-(CCSprite*)setSpriteByName:(NSString*)name;
-(void)showSprite:(NSString*)name;
-(void)hideSprite:(NSString*)name;
-(void)addAction:(CCAction*)action Named:(NSString*)name;
-(void)runAction:(NSString*)name WithSprite:(NSString*)spritename;
-(void)runAction:(NSString*)name WithSprite:(NSString*)spritename Dur:(float)dur;
-(void)runActionRepeated:(NSString*)name WithSprite:(NSString*)spritename;
-(void)stopAction:(NSString*)name WithSprite:(NSString*)spritename;
-(void)stopAllActionWithSprite:(NSString*)spritename;
-(void)stopAllAction;
-(void)startAi;
-(void)setAi:(FAI*)ai;

-(CGRect)getObjectRect;
-(CGPoint)getWorldPointWithName:(NSString*)name;
@end
